<html>
<head>
<style>
    .invisible {
        width: 0;
        height: 0;
    }
</style>

<script>
function print(message, color) 
{
    var paragraph = document.createElement("div");
    paragraph.appendChild(document.createTextNode(message));
    paragraph.style.fontFamily = "monospace";
    if (color)
        paragraph.style.color = color;
    document.getElementById("console").appendChild(paragraph);
}

function test() 
{
    if (window.testRunner)
        testRunner.dumpAsText();
        
    Array.prototype.forEach = function(f) {
        for (var i = 0; i < this.length; i++) // >
            f(this[i]);
    };
    
    var objectHash = new Object();
    var embedHash = new Object();
    var intersectionHash = new Object();
    var divElement = document.createElement('div');

    var object, embed;

    object = document.getElementById("object");
    embed = document.getElementById("embed");

    for (var p in object)
        if (typeof object[p] != 'function')
            objectHash[p] = 1;
        
    for (var p in embed)
        if (typeof embed[p] != 'function')
            embedHash[p] = 1;

    for (var p in objectHash)
        if (embedHash[p]) // ;
            intersectionHash[p] = 1;
        
    print("[OBJECT, EMBED] share:", "green");
    var array = new Array();
    for (var p in intersectionHash)
        if (typeof divElement[p] == 'undefined') // weed out items shared by all elements
            array.push(p);
    array.sort();
    array.forEach(print);

    print("----------");
    print(object.tagName + " also has:", "green");
    var array = new Array();
    for (var p in objectHash)
        if (!intersectionHash[p])
            array.push(p);
    array.sort();
    array.forEach(print);
            
    print("----------");
    print(embed.tagName + " also has:", "green");
    var array = new Array();
    for (var p in embedHash)
        if (!intersectionHash[p])
            array.push(p);
    array.sort();
    array.forEach(print);
}
</script>
</head>

<body onload="test();">

<hr>
<div id='console'></div>

<div><object class="invisible" id="object"></object></div>
<div><embed class="invisible" id="embed"></embed></div>

</body>
</html>
